// Standard Lib
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Database.h"


Database::Database (void)
{
}

Database::Database (char *cServer, char *cUser,char *cDb, char *cPass)
{
    setServer(cServer);
    setDb(cDb);
    setUser(cUser);
    setPass(cPass);
}

Database::~Database(void)
{
    reset();
}

void Database::reset(){
    if(strlen(server)>0) delete(server);
    if(strlen(db)>0) delete(db);
    if(strlen(passwd)>0) delete(passwd);
    if(strlen(user)>0) delete(user);
}
void Database::setServer(char *cServer){
    server = new char[strlen(cServer)];
    strcpy(server, cServer);
}

void Database::setDb(char *cDb){
    db = new char[strlen(cDb)];
    strcpy(db, cDb);
}

void Database::setUser(char *cUser){
    user = new char[strlen(cUser)];
    strcpy(user, cUser);
}

void Database::setPass(char *cPass){
    passwd = new char[strlen(cPass)];
    strcpy(passwd, cPass);
}


char *Database::getServer(){
    return(server);
}

char *Database::getDb(){
    return(db);
}

char *Database::getUser(){
    return(user);
}

char *Database::getPass(){
    return(passwd);
}
